/**
 * Created by robin.tian on 17-2-13.
 */
var fs = require("fs");

var data = '';

//创建可读流

var readStream = fs.createReadStream('input.txt');

//设置编码为Utf8
readStream.setEncoding('UTF8');

//处理时间流——> data ,end,and error

readStream.on('data', function (chunk) {
    data += chunk;
});

readStream.on('end',function () {
    console.log(data);
});

readStream.on('error',function (err) {
    console.log(err.stack);
});

console.log("程序执行完毕");

